package io.lvdaxian.mybatis19.scripting.xmltags;

import io.lvdaxian.mybatis19.io.Resources;
import ognl.ClassResolver;

import java.util.HashMap;
import java.util.Map;

public class OgnlClassResolver implements ClassResolver {
  
  private Map<String, Class<?>> classes = new HashMap<>(101);
  
  @Override
  public Class classForName(String className, Map context) {
    Class<?> result = null;
    if ((result = classes.get(className)) == null) {
      result = Resources.classForName(className);
      classes.put(className, result);
    }
    return result;
  }
  
}
